package org.hyjiacan.deadqq.common.util;

import java.awt.Dimension;

import java.awt.Window;

public final class WindowUtil {
	// 屏幕尺寸
	private static Dimension screen;

	private WindowUtil() {

	}

	public static void center(Window frame) {
		if (frame == null) {
			return;
		}
		if (screen == null) {
			screen = frame.getToolkit().getScreenSize();
		}
		frame.setLocation((screen.width - frame.getWidth()) / 2,
				(screen.height - frame.getHeight()) / 2);
		frame.validate();
	}
}
